#-*-coding:utf-8-*-
import hou
class Node(object):
    def __init__(self):
        super(Node,self).__init__()




    #获取当前节点面板显示父节点
    def nodepwd(self):
        net_editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
        currentParentNode = net_editor.pwd()
        return currentParentNode







    # 根据节点名称匹配多个节点
    # create and detroy
    def createNode(self,nodeType,nodeName): #创建节点
        npwd=self.nodepwd()
        node=None
        if nodeName=='':
            node= npwd.createNode(nodeType)

            #print('nodeType')
        else:
            node=npwd.createNode(nodeType,nodeName)

            #print('nodeType and nodeName')
        node.setSelected(1,1,1)
        return node


    def destroy(self,node):#删除节点
        node.destroy()
        #print('destroy node')




#   geo
    def aiCreate(self,nodeType,nodeName):
        npwd=self.nodepwd()
        node=None
        if npwd.name()=='obj':
            geo= npwd.createNode("geo",nodeName)
            box=geo.createNode(nodeType)

        else:
            try:
                box=npwd.createNode(nodeType)

            except:
                hou.ui.displayMessage('Can`t create box in this node')

        node.setSelected(1,1,1)
        return node


